package sng.modules.view
{
	
	import flash.net.sendToURL;
	
	import mx.controls.Label;
	import mx.core.UIComponent;
	
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	import sng.modules.model.vo.LoginVO;
	import sng.modules.system.CitySystem;
	import sng.modules.system.NameSpace;
	import sng.modules.system.SocialSystem;
	import sng.modules.view.components.MapBG;
	import sng.modules.view.components.hud.HUDmain;

	/**
	 * 
	 * @author leonliu
	 * 
	 */	
	public class ApplicationMediator extends Mediator
	{
		private var main:Main;
		//构造器，获取application实例
		public function ApplicationMediator(app:Object)
		{
			super(NameSpace.ApplicationMediatorName,app);
			main = app as Main;
		}
		//监听通知
		override public function listNotificationInterests():Array{
			return[NameSpace.LoginSuccess];
		}
		//响应通知
		override public function handleNotification(notification:INotification):void{
			switch (notification.getName()){
				case NameSpace.LoginSuccess:
					setLoginSuc(notification.getBody() as LoginVO);
					break;
				default:
					break;
			}
		}
		
		/**
		 * 
		 * @param loginVO
		 * 登录成功后触化
		 */		
		private function setLoginSuc(loginVO:LoginVO):void{
//			var hudmain:HUDmain=new HUDmain();
			//城建系统初始化
			sendNotification(CitySystem.CityStart, main);
			//社交系统初始化
			sendNotification(SocialSystem.SocialStart, main);
			//初始化主界面
			sendNotification(NameSpace.HudInitUI,main);
			
		}
	}
}